lint: ignore js file#4431
Conversation
| const config = { | ||
| rest: { | ||
| port: +process.env.PORT || 3000, | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing |
There was a problem hiding this comment.
The ts eslint rules like @typescript-eslint/prefer-nullish-coalescing shouldn't check js file
There was a problem hiding this comment.
Is it required for the build to pass? We already have this override - https://github.com/strongloop/loopback-next/blob/master/packages/eslint-config/eslintrc.js#L158
There was a problem hiding this comment.
@raymondfeng Not really, our code base is good, and adding this line results in lint error...
But the todo example created by lb4 example complains:
lb4 example (choose todo)
cd loopback4-example-todo
npm i
npm run lint
> @loopback/example-todo@1.9.4 lint /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> npm run prettier:check && npm run eslint
> @loopback/example-todo@1.9.4 prettier:check /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> npm run prettier:cli -- -l
> @loopback/example-todo@1.9.4 prettier:cli /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> lb-prettier "**/*.ts" "-l"
> @loopback/example-todo@1.9.4 eslint /Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo
> lb-eslint --report-unused-disable-directives .
/Users/jannyhou/Desktop/2019/ui/test/loopback4-example-todo/index.js
15:30 error Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator @typescript-eslint/prefer-nullish-coalescing
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
There was a problem hiding this comment.
I see. I wonder why https://github.com/strongloop/loopback-next/blob/master/packages/eslint-config/eslintrc.js#L158 does not exclude js files. Can you check which version of @loopback/eslint-config is pulled in?
There was a problem hiding this comment.
@raymondfeng It's already on the latest released version @loopback/eslint-config@5.0.1
There was a problem hiding this comment.
There was a problem hiding this comment.
@raymondfeng 👍 tested the config file, I think the necessary config is extends: ['@loopback/eslint-config']
Details verified in comment #4431 (comment)
a460bd5 to
f0ef5fc
Compare
f0ef5fc to
1a17242
Compare
|
Verified with the latest cloned todo example: before adding the .eslintrc.js file jannyHous-MacBook-Pro:loopback4-example-todo jannyhou$ npm run clean after adding the .eslintrc.js file |
1a17242 to
34ea4f1
Compare
34ea4f1 to
4852884
Compare
Fixes #4205
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈